<template>
  <div>
    <div class="main">
      <van-field
        label="报告模板"
        v-model="form.TemplateName"
        name="TemplateName"
        readonly
      ></van-field>
      <van-field
        label="年份"
        v-model="form.Key"
        name="Key"
        readonly
      ></van-field>
      <van-field
        class="input_text"
        label="当前编号"
        v-model="form.CurrentNum"
        type="number"
        name="CurrentNum"
        required
      >
      </van-field>
      <div class="btn_submit">
        <van-button block type="info" @click="submit"> 提交 </van-button>
      </div>
    </div>
  </div>
</template>

<script>
import {
  getDetail,
  save
} from '@/api/qy';
import { mapGetters } from "vuex";
export default {
  data() {
    return {
      templateCode: "",
      form: {
        TemplateCode:"",
        TemplateName:"",
        Key: "",
        CurrentNum:null,
      },
    };
  },

  computed: {
    ...mapGetters(["baseUrl", "CompanyCode", "roles"]),
  },

  created() {
    if (this.$route.query.templateCode) {
      (this.templateCode = this.$route.query.templateCode), this.getDetail();
    }
  },
  methods: {
    getDetail() {
      let params = { templateCode: this.templateCode };
      if (this.id == 0) {
      } else {
        getDetail(params).then((res) => {
          this.form = res.data;
        });
      }
    },
    submit() {
      save(this.form).then((res) => {
        this.$toast.success("保存成功");
        setTimeout(() => {
          this.$router.push("/DangerReportNumSet");
        }, 500);
      });
    },
  },
};
</script>

<style lang="less" >
.wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.block {
  width: 120px;
  height: 120px;
  background-color: #fff;
}
</style>
<style lang="less" scoped>
.space-between {
  justify-content: space-between;
}
</style>
